package org.example.design.代理.动态;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @Auther:Liu
 * @Testname:DynamicProxyHandler
 * @Date:2025/8/15 16:15
 */
public class DynamicProxyHandler implements InvocationHandler {
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("开始执行任务");
        System.out.println("执行的任务是:"+method.getName());
        System.out.println("传递的参数是:"+ Arrays.toString(args));
        System.out.println("执行完毕"+method.getName()+"方法");
        if (method.getName().equals("save")){
            return null;
        }else{
            return "张三";
        }
    }
}
